package com.ruoyi.web.controller.market.special;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.db.model.param.SpecialDataParam;
import com.ruoyi.special.service.ISpecialDataInfoService;
import com.ruoyi.web.wapper.SpecialDataInfoWapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 特殊渠道数据Controller
 * 
 * @author ruoyi
 * @date 2022-11-18
 */
@Controller
@RequestMapping("/special/data")
public class SpecialDataInfoController extends BaseController
{
    private String prefix = "special/data";

    @Autowired
    private ISpecialDataInfoService specialDataInfoService;


    @RequiresPermissions("special:data:view")
    @GetMapping("/{infoId}")
    public String data(@PathVariable("infoId")Long infoId, ModelMap modelMap)
    {
        modelMap.put("infoId", infoId);
        return prefix + "/data";
    }

    /**
     * 查询特殊渠道数据列表
     */
    @RequiresPermissions("special:data:view")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SpecialDataParam specialDataParam)
    {
        startPage();
        List<Map<String, Object>> mapList = specialDataInfoService.selectSpecialDataInfoListMap(specialDataParam);
        mapList = new SpecialDataInfoWapper(mapList).wrap();
        return getDataTable(mapList);
    }



    @RequiresPermissions("special:data:view")
    @GetMapping( "/lists")
    public String lists()
    {
        return prefix + "/datas";
    }

}
